<?php

	error_reporting(E_ALL);
	ini_set('display_errors', TRUE);
	ini_set('display_startup_errors', TRUE);

	//echo '<pre>';
	//print_r($_POST);exit;
	$payment_amount = $_POST['payment_amount'];
	$payers_account = $_POST['payers_account'];

        // create curl resource 
        $ch = curl_init(); 

        // set url
        curl_setopt($ch, CURLOPT_URL, "http://176.9.51.8/eng/thirdparty/getcustomer.jsp?name={$payers_account}&loginName=agent&loginPassword=123456"); 

        //return the transfer as a string 
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

        // $output contains the output string 
        $output = curl_exec($ch);

        // close curl resource to free up system resources 
        curl_close($ch);      

?>

<?php include('header.php'); ?>
    <div class='container'>
	<?php if(trim($output) != "-10007|Not found, operation failed.") { ?>
		
			<form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="paypal-payment-form" accept-charset="UTF-8">

				<input type="hidden" name="cmd" value="_xclick">
				<input type="hidden" name="business" value="pay@iptelservices.com">
				<input type="hidden" name="amount" value="<?php echo $payment_amount; ?>">
				<input type="hidden" name="no_note" value="1">
				<input type="hidden" name="currency_code" value="USD">
				<!-- <input type="hidden" name="address_override" value="1"> -->
<!-- 				<input type="hidden" name="email" value="<?php //echo $payers_account; ?>">
 -->
 				<input type="hidden" name="item_name" value="IPTEL Service">
 				<input type="hidden" name="custom" value="<?php echo $payers_account; ?>"/>
				<input type="hidden" name="return" value="http://www.iptelservices.com/paypal/transaction_complete.php">
				<input type="hidden" name="notify_url" value="http://www.iptelservices.com/paypal/ipn_processing.php">
				<input type="hidden" name="rm" value="2">
				<p class="help-text">processing ... </p>
				<input type="submit" id="edit-submit" name="op" value="Submit" class="form-submit">
				<p class="help-text2">Please click the "submit" button if you are not taken to the paypal page.</p>
			</form>


	<?php } else {?>

		<p class='wrong-message'>Given Account number is not valid</p>

	<?php } ?>

	</div>
	<?php include('footer.php'); ?>